package com.mybatis.basic;

import java.util.List;

import org.apache.log4j.Logger;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class JsonUtils {

	private static final Logger log = Logger.getLogger(JsonUtils.class);

	public String objectToString(Object obj) {
		return JSONObject.toJSONString(obj);
	}

	public <T> T stringToEntity(String json,Class<T> clazz) {
		return JSONObject.parseObject(json, clazz);
	}

	public <T> List<T> stringToEntityList(String json,Class<T> clazz){
		return JSONArray.parseArray(json, clazz);
	}
}
